<?php
require_once ($INCLUDE_PATH . "./include/WebService2Db.php");
class UserModel {
    public function saveUserInfo($s) {
        $s1 = 'id';
        $s2 = "'".$s['id']."'";
        foreach ($s as $key => $ss){
            if($key != 'id')
            {
                $s1 .= ",".$key;
                $s2 .= ",'".$ss."'";
            }
        }
        $DB=new DB_MYSQL;
        $sql="insert into `".PRE."_user`(".$s1.")" ."VALUES(".$s2.")";

        //  $sql="SELECT *  FROM `hh_user` WHERE `account` = '".$username."' AND `password` = '".$password."'";
        $query = $DB->insert($sql,DB);
        //  echo $DB->insert_id;
        return $DB->insert_id;
    }
    public function getListCount()
    {
        $where = " where state = 1";
        $DB=new DB_MYSQL;
        $table=PRE."_user";
        $sum=$DB->count_records($table,"id",$where,DB);
        return $sum;

        // echo $sum;
    }
    public function getList($page,$liststart,$pageSize)
    {
        $DB=new DB_MYSQL;
        $sql="SELECT *  FROM `".PRE."_user` WHERE  state = 1 LIMIT ".$liststart.",".$pageSize;
        $query = $DB->fetch_array($sql,DB);
        return $query;

    }

}
?>
